<!DOCTYPE html>
<html>

<head>
	<link rel="icon" href="${require('./img/richgo.ico')}" type="image/x-icon" />
	<link rel="shortcut icon" href="${require('./img/richgo.ico')}" type="image/x-icon" />
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<style type="text/css">
		* {
			margin: 0;
			padding: 0;
		}

		html,
		body {
			font-size: 0px;
			height: 100%;
			display: -webkit-box;
			display: -ms-flexbox;
			display: -webkit-flex;
			display: flex;
			-webkit-box-orient: vertical;
			-ms-flex-direction: column;
			-webkit-flex-direction: column;
			flex-direction: column;
			-webkit-box-pack: justify;
			-ms-flex-pack: justify;
			-webkit-justify-content: space-between;
			justify-content: space-between;

		}

		#down {
			width: 100%;
			background-color: #fff;
			-webkit-box-flex: 1;
			-ms-flex: 1;
			-webkit-flex: 1;
			flex: 1;
			overflow: auto;
		}

		.img {
			width: 100%;
		}

		.img1 {
			margin-top: 28px;
		}

		.link {
			height: 50px;
			background-color: #010825;
		}

		#JdownApp,
		#JdownApp2 {
			display: inline-block;
			height: 50px;
			width: 48%;
			font-size: 19px;
			line-height: 50px;
			text-align: center;
			text-decoration: none;
			color: #fed735;
		}

		#JdownApp2 {
			border-left: 1px solid #fed735;
			box-sizing: border-box;
		}

		.wxtip {
			background: rgba(0, 0, 0, 0.8);
			text-align: center;
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			z-index: 998;
			display: none;
		}

		.wxtip-icon {
			width: 228px;
			height: 175px;
			display: block;
			position: absolute;
			right: 60px;
			top: 20px;
		}

		.wxtipIos {
			background: url("${require('./img/weixin-ios.png')}") no-repeat;
		}

		.wxtipAndroid {
			background: url("${require('./img/weixin-tip.png')}") no-repeat;
		}
	</style>
</head>

<body style='overflow:-Scroll; overflow-y:hidden'>
	<div id="down">
		<img src="${require('./img/1.jpg')}" class="img">
		<img src="${require('./img/2.jpg')}" class="img img1">
		<img src="${require('./img/3.jpg')}" class="img img1">
		<!-- ios的指示 -->
		<div class="wxtip" id="weixinIos">
			<span class="wxtip-icon wxtipIos"></span>
		</div>
		<!-- 安卓的指示 -->
		<div class="wxtip" id="JweixinAndroid">
			<span class="wxtip-icon wxtipAndroid"></span>
		</div>
	</div>
	<div class='link'>
		<a id="JdownApp" class="btn-warn" htmdEvt="android_click">安卓下载</a>
		<a id="JdownApp2" htmdEvt="ios_click">iOS下载</a>
	</div>
</body>
<script type="text/javascript">
	(function (doc, win) { var docEl = doc.documentElement, resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', recalc = function () { var clientWidth = docEl.clientWidth; if (!clientWidth) return; docEl.style.fontSize = 100 * (clientWidth / 750) + 'px'; }; if (!doc.addEventListener) return; win.addEventListener(resizeEvt, recalc, false); doc.addEventListener('DOMContentLoaded', recalc, false); })(document, window);
</script>
<script>
	function weixinTip(ele, btnType) {
		var ua = navigator.userAgent;
		var isWeixin = !!/MicroMessenger/i.test(ua);
		if (isWeixin) {
			if (btnType == 'ios') {
				ele.onclick = function (e) {
					window.event ? window.event.returnValue = false : e.preventDefault();
					document.getElementById('weixinIos').style.display = 'block';
				}
				document.getElementById('weixinIos').onclick = function () {
					this.style.display = 'none';
				}
			} else {
				ele.onclick = function (e) {
					window.event ? window.event.returnValue = false : e.preventDefault();
					document.getElementById('JweixinAndroid').style.display = 'block';
				}
				document.getElementById('JweixinAndroid').onclick = function () {
					this.style.display = 'none';
				}
			}

		} else {
			if (btnType == 'ios') {
				ele.onclick = function (e) {
					ajax({
						method: 'POST',
						url: '/api/home/selectNewVersions',
						success: function (data) {
							//在这里对获取的数据经常操作
							window.location.href = data.ios.updateUrl
						}
					})

				}
			} else {
				ele.onclick = function (e) {
					ajax({
						method: 'POST',
						url: '/api/home/selectNewVersions',
						success: function (data) {
							//在这里对获取的数据经常操作
							window.location.href = data.android.updateUrl
						}
					})
				}
			}
		}
	}
	var btn1 = document.getElementById('JdownApp');//安卓下载
	weixinTip(btn1, "android");
	var btn2 = document.getElementById('JdownApp2'); //ios下载
	weixinTip(btn2, "ios");

	/* 封装ajax函数
	* @param {string}opt.type http连接的方式，包括POST和GET两种方式
	* @param {string}opt.url 发送请求的url
	* @param {boolean}opt.async 是否为异步请求，true为异步的，false为同步的
	* @param {object}opt.data 发送的参数，格式为对象类型
	* @param {function}opt.success ajax发送并接收成功调用的回调函数
	*/
	function ajax(opt) {
		opt = opt || {};
		opt.method = opt.method.toUpperCase() || 'POST';
		opt.url = opt.url || '';
		opt.async = opt.async || true;
		opt.data = opt.data || null;
		opt.success = opt.success || function () { };
		var xmlHttp = null;
		if (XMLHttpRequest) {
			xmlHttp = new XMLHttpRequest();
		}
		else {
			xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
		} var params = [];
		for (var key in opt.data) {
			params.push(key + '=' + opt.data[key]);
		}
		var postData = params.join('&');
		if (opt.method.toUpperCase() === 'POST') {
			xmlHttp.open(opt.method, opt.url, opt.async);
			xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=utf-8');
			xmlHttp.send(postData);
		}
		else if (opt.method.toUpperCase() === 'GET') {
			xmlHttp.open(opt.method, opt.url + '?' + postData, opt.async);
			xmlHttp.send(null);
		}
		xmlHttp.onreadystatechange = function () {
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
				opt.success(JSON.parse(xmlHttp.responseText));//如果不是json数据可以去掉json转换
			}
		};
	}
</script>


<script type="text/javascript" id="htmdScript"  src="<%=htmlWebpackPlugin.options.mdUrl%>"></script>

<script type="text/javascript">

	var mdPathList = {
		"/lgbCdn/downloadGuide/" : { evtid: 'lgb_h5_downloadGuide', topic: '理顾宝App下载页', info: ''}
	};

	var mdClickList = {
		"android_click" : { evtid: 'lgb_h5_android_click', topic: '理顾宝App下载页_点击安卓下载按钮', info: ''},
		"ios_click" : { evtid: 'lgb_h5_ios_click', topic: '理顾宝App下载页_点击ios下载按钮', info: ''}
	}


	//调用埋点底层方法
	var mdObj = {

		//pf参数，表示当前项目，必传
		pf: 2, 

		//pc/app/wap，必传
		type: 'wap',  

		//页面路径对应id配置，用于页面进入离开的埋点请求，必传
		mdPathList : mdPathList ,  

		mdClickList: mdClickList

	}
	
	window._htmd && window._htmd(mdObj);

</script>

</html>
